package me.yobol.algorithm.inaction.netease;

import java.util.Scanner;

/**
 *
 * @author Yobol
 */
public class Shuffle {
    
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int total = scanner.nextInt();
        for(int i = 0;i < total;i++){
            int n = scanner.nextInt();
            int k = scanner.nextInt();
            int[] b = new int[2 * n];
            for(int j = 0;j < 2 * n;j++){
                b[j] = scanner.nextInt();
            }
            
            for(int j = 0;j < k;j++){
                shuffle(b);
            }
            
            for(int j = 0;j < 2 * n;j++){
                if(j == 0){
                    System.out.print(b[j]);
                }else{
                    System.out.print(" " + b[j]);
                }
            }
            
            System.out.println("");
            
        }
        scanner.close();
    }
    
    public static void shuffle(int[] b){
        int n = b.length / 2;
        int[] b1 = new int[n];
        for (int i = 0; i < b1.length; i++) {
            b1[i] = b[i];
        }
        
        int[] b2 = new int[n];
        for (int i = 0; i < b2.length; i++) {
           b2[i] = b[n + i];
        }
        
        for(int i = n * 2 - 1;i > 0;i--){
            if(i % 2 == 1){
                b[i] = b2[(i - 1) / 2];
            }else{
                b[i] = b1[i / 2];
            }
        }
    }
}